package com.yunji.storage.service.impl;

import com.yunji.storage.bo.StockTakeInfoListQueryBO;
import com.yunji.storage.dao.IStockTakeInfoDao;
import com.yunji.storage.domain.StockTakeInfoDO;
import com.yunji.storage.mapper.StockTakeInfoMapper;
import com.yunji.storage.service.IStockTakeInfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Project: yunji-coffee
 * @Package: com.yunji.storage.service.impl
 * @Title: StockTakeInfoServiceImpl
 * <p>
 * History:
 * Date                     Version     Author          Summary
 * ============================================================
 * 2024-08-30 10:24:42      V1.0        HuaAo       新建类
 */
@Service
public class StockTakeInfoServiceImpl implements IStockTakeInfoService {

    @Resource
    StockTakeInfoMapper stockTakeInfoMapper;

    @Resource
    IStockTakeInfoDao stockTakeInfoDao;

    @Override
    public List<StockTakeInfoDO> search(StockTakeInfoListQueryBO bo) {
        return stockTakeInfoDao.search(bo);
    }

    @Override
    public boolean delete(List<Long> infoIds) {
        return stockTakeInfoDao.removeByIds(infoIds);
    }

    @Override
    public boolean create(StockTakeInfoDO stockTakeInfo) {
        return stockTakeInfoDao.save(stockTakeInfo);
    }

    @Override
    public boolean update(StockTakeInfoDO stockTakeInfo) {
        return stockTakeInfoDao.updateById(stockTakeInfo);
    }

    @Override
    public boolean deleteByStockTakeIds(Long... stockTakeIds) {
        return stockTakeInfoDao.deleteBYStockTakeIds(stockTakeIds);
    }

    /**
     * @param infoId 详情ID
     * @Title cleanData
     * @Desc 清理数据
     * @Date 2024-08-31 09:26:59.802
     */
    @Override
    public boolean cleanData(Long... infoIds) {
        return stockTakeInfoMapper.cleanData(new StockTakeInfoDO(), infoIds) > 0;
    }
}